<?/*------------------------------Подготовка крайних значений для фильтра---------------------------------------*/ ?>
<?php if($this->filter):?>
<?php 
	$prices=array();
	$gab_width=array();
	$gab_length=array();
	$sleep_width=array();
	$sleep_length=array();
	
	foreach ($this->items as $item){
		if(!empty($item['price'])){
			$prices[]=$item['price'];
		}
		if(!empty($item['gab_width'])){
			$gab_width[]=$item['gab_width'];
		}
		if(!empty($item['gab_length'])){
			$gab_length[]=$item['gab_length'];
		}
		if(!empty($item['sleep_width'])){
			$sleep_width[]=$item['sleep_width'];
		}
		if(!empty($item['sleep_length'])){
			$sleep_length[]=$item['sleep_length'];
		}
	}
?>




<div id="catalog_filter">
	<ul id="filter_type" class="clearfix">
		<li class="active">
			<a rel="all" href="#" class="all">Показать все</a>
		</li>
		<li class="params" >
			<a rel="filter" href="#">Подобрать по параметрам</a>
		</li>
		
	</ul>
	<div id="catalog_filter_content" class="clearfix roundCorners">
	<form action="" id="filter_form" class="clearfix" style="display: none;">
		<table>
		<tr>
		<td class="column">
			<label for="length_from">Длина от&nbsp;</label><input type="text" id="length_from" name="length_from" value="<?=round(min($gab_length),-2)?>"/>
			<label for="length_to">до&nbsp;</label><input type="text" id="length_to" name="length_to" value="<?=round(max($gab_length),-2)?>"/>
			<span class="slider" id="slider_length">
			<span class="min"><?=round(min($gab_length),-2) ?><br/>|</span><span class="middle"><?=round((max($gab_length)-min($gab_length))/2+min($gab_length),-2) ?><br/>|</span><span class="max"><?=round(max($gab_length),-2) ?><br/>|</span>
			</span>
		</td>
		<td>&nbsp;</td>
		<td class="column">
		<label for="price_from">Цена от&nbsp;</label><input type="text" id="price_from" name="price_from" value="<?=round(min($prices),-2) ?>"/>
			<label for="price_to">до&nbsp;</label><input type="text" id="price_to" name="price_to" value="<?=round(max($prices),-2) ?>"/>
			<span class="slider" id="slider_price">
			<span class="min"><?=round(min($prices),-2) ?><br/>|</span><span class="middle"><?=round((max($prices)-min($prices))/2+min($prices),-2) ?><br/>|</span><span class="max"><?=round(max($prices),-2) ?><br/>|</span>
			</span>
			
		</td>
		<td>&nbsp;</td>
		<td class="column" style="text-align: center;">
			<img src="/site/theme/img/wh.png" alt=""/>
			
		</td>
		</tr>
		<tr>
		<td class="column">
		<label for="width_from">Ширина от&nbsp;</label><input type="text" id="width_from" name="width_from" value="<?=round(min($gab_width),-2)?>"/>
			<label for="width_to">до&nbsp;</label><input type="text" id="width_to" name="width_to" value="<?=round(max($gab_width),-2)?>"/>
			<span class="slider" id="slider_width">
				<span class="min"><?=round(min($gab_width),-2) ?><br/>|</span><span class="middle"><?=round((max($gab_width)-min($gab_width))/2+min($gab_width),-2) ?><br/>|</span><span class="max"><?=round(max($gab_width),-2)?><br/>|</span>
			</span>
		</td>
		<td>&nbsp;</td>
		<td><input type="checkbox" name="chear" id="chear"/>
			<label for="chear">Только в комплекте с креслом</label></td>
		<td>&nbsp;</td>
		<td style="text-align: center;vertical-align: middle;">
			<a class="button" style="background-color: #F5EAE2" onclick="$(this).closest('form').submit();return false;"><span>Показать</span></a>
		</td>
		</tr>
		
		
		</table>
		
	</form>
	</div>
</div>
<?php endif;?>
